/*    */ package com.qmsk.business.member.memberBalance.controller;
/*    */ 
/*    */ import com.qmsk.business.member.memberBalance.dao.MemberBalanceDao;
/*    */ import com.utils.basic.MapUtils;
/*    */ import com.utils.gson.out.GsonEbRst;
/*    */ import com.utils.web.RequestUtils;
/*    */ import com.utils.web.ResponseUtils;
/*    */ import java.sql.SQLException;
/*    */ import java.util.Date;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.web.bind.annotation.PathVariable;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"memberBalance"})
/*    */ public class MemberBalanceController
/*    */ {
/* 29 */   private static final Logger logger = Logger.getLogger(MemberBalanceController.class);
/*    */ 
/*    */   @Autowired
/*    */   private MemberBalanceDao dao;
/*    */ 
/*    */   @RequestMapping(value={"find/shopId/{shopId}/opt/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void getListShopId(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") String shopId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*    */   {
/* 49 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*    */     try {
/* 51 */       Map params = new HashMap();
/* 52 */       MapUtils.addToMap(params, "mp", 
/* 53 */         RequestUtils.getString(request, "mp"));
/* 54 */       MapUtils.addPercentToMap(params, "name", 
/* 55 */         RequestUtils.getString(request, "name"));
/* 56 */       MapUtils.addToMap(params, "cardNo", 
/* 57 */         RequestUtils.getString(request, "cardNo"));
/* 58 */       MapUtils.addToMap(params, "levelId", 
/* 59 */         RequestUtils.getInt(request, "levelId"));
/* 60 */       MapUtils.addToMap(params, "cardStatus", 
/* 61 */         RequestUtils.getInt(request, "cardStatus"));
/* 62 */       getAddBirthDay(params, request);
/* 63 */       GsonEbRst gsonEbRst = this.dao.getGsonOfShopId(params, nPageIdx, 
/* 64 */         nPageSize);
/* 65 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*    */     } catch (SQLException e) {
/* 67 */       logger.error(e);
/* 68 */       ResponseUtils.setErrorMsgResponse(
/* 69 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ 
/*    */   private void getAddBirthDay(Map<String, Object> params, HttpServletRequest request)
/*    */   {
/* 75 */     Date date = RequestUtils.getDate(request, "birthDay");
/* 76 */     if (date == null) {
/* 77 */       return;
/*    */     }
/* 79 */     MapUtils.addToMap(params, "birthDayStart", new Date(date.getTime() - 86400000L));
/*    */ 
/* 81 */     MapUtils.addToMap(params, "birthDayEnd", new Date(date.getTime() + 86400000L));
/*    */   }
/*    */ 
/*    */   @RequestMapping(value={"find/shopId/{shopId}/opt/sum"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void getListShopIdSum(HttpServletRequest request, HttpServletResponse response, @PathVariable("shopId") String shopId)
/*    */   {
/*    */     try
/*    */     {
/* 98 */       Map params = new HashMap();
/* 99 */       MapUtils.addToMap(params, "mp", 
/* 100 */         RequestUtils.getString(request, "mp"));
/* 101 */       MapUtils.addPercentToMap(params, "name", 
/* 102 */         RequestUtils.getString(request, "name"));
/* 103 */       MapUtils.addToMap(params, "cardNo", 
/* 104 */         RequestUtils.getString(request, "cardNo"));
/* 105 */       MapUtils.addToMap(params, "levelId", 
/* 106 */         RequestUtils.getInt(request, "levelId"));
/* 107 */       MapUtils.addToMap(params, "cardStatus", 
/* 108 */         RequestUtils.getInt(request, "cardStatus"));
/* 109 */       getAddBirthDay(params, request);
/* 110 */       GsonEbRst gsonEbRst = this.dao.getGsonOfShopIdSum(params);
/* 111 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*    */     } catch (SQLException e) {
/* 113 */       logger.error(e);
/* 114 */       ResponseUtils.setErrorMsgResponse(
/* 115 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.memberBalance.controller.MemberBalanceController
 * JD-Core Version:    0.5.3
 */